<?php
/**
* @file $Id: RequestsReport.php 161 2006-09-07 06:21:17Z doritojones $
* @package Focus/SIS
* @copyright Copyright (C) 2006 Andrew Schmadeke. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
* Focus/SIS is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.txt for copyright notices and details.
*/

	$count_RET = DBGet(DBQuery("SELECT cs.TITLE as SUBJECT_TITLE,c.TITLE as COURSE_TITLE,sr.COURSE_ID,sr.COURSE_WEIGHT,COUNT(*) AS COUNT,(SELECT sum(TOTAL_SEATS) FROM COURSE_PERIODS cp WHERE cp.COURSE_ID=sr.COURSE_ID AND cp.COURSE_WEIGHT=sr.COURSE_WEIGHT) AS SEATS FROM SCHEDULE_REQUESTS sr,COURSES c,COURSE_SUBJECTS cs WHERE cs.SUBJECT_ID=c.SUBJECT_ID AND sr.COURSE_ID=c.COURSE_ID AND sr.SYEAR='".UserSyear()."' AND sr.SCHOOL_ID='".UserSchool()."' GROUP BY sr.COURSE_ID,sr.COURSE_WEIGHT,cs.TITLE,c.TITLE"),array(),array('SUBJECT_TITLE'));
	$columns = array('SUBJECT_TITLE'=>_('Subject'),'COURSE_TITLE'=>_('Course'),'COURSE_WEIGHT'=>_('Weight'),'COUNT'=>_('Number of Requests'),'SEATS'=>_('Seats'));
	
	DrawHeader(ProgramTitle());
	ListOutput($count_RET,$columns,'','',array(),array(array('SUBJECT_TITLE')));
?>